import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:yqmssa_app/widget/my_customer_video_player_widget.dart';

import 'landing_manager.dart';

class LandingView extends StatelessWidget {
  const LandingView({super.key});

  @override
  Widget build(BuildContext context) {
    final manager = Get.put(LandingManager()); // Replace with your video URL
    return Scaffold(
      extendBodyBehindAppBar: true,
      appBar: AppBar(
        backgroundColor: Colors.transparent,
        leading: IconButton(
          icon: const Icon(Icons.arrow_back_ios, color: Colors.white),
          onPressed: Get.back,
        ),
      ),
      body: Column(
        children: [
          Container(
            width: double.maxFinite,
            color: Colors.black,
            child: AspectRatio(
              aspectRatio: 16 / 9,
              child: Obx(() {
                if ((manager.data.value.video?.videofile ?? "").isEmpty) {
                  return const SizedBox();
                }
                return MyCustomVideoPlayerWidget(
                  videoUrl: manager.data.value.video?.videofile ?? "",
                  controlCall: (value) {
                    manager.betterPlayerController = value;
                  },
                );
              }),
            ),
          ),
          Expanded(
            child: SingleChildScrollView(
              child: Obx(() {
                return Image.network(
                  manager.data.value.video?.introduceImage ?? "",
                  width: double.maxFinite,
                  errorBuilder: (context, object, _) {
                    return const SizedBox();
                  },
                );
              }),
            ),
          ),
        ],
      ),
      bottomNavigationBar: Container(
        color: Colors.white,
        margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
        padding: const EdgeInsets.only(bottom: 8),
        child: InkWell(
          onTap: manager.showSheet,
          child: Container(
            height: 48,
            decoration: BoxDecoration(
              gradient: const LinearGradient(colors: [Color(0XFFF4DDC2), Color(0XFFE4B591)]),
              borderRadius: BorderRadius.circular(4),
            ),
            alignment: Alignment.center,
            child: const Text(
              "立即获取逾期解决方案",
              style: TextStyle(fontSize: 18, fontWeight: FontWeight.w600, color: Color(0XFF4A1C02)),
            ),
          ),
        ),
      ),
    );
  }
}
